<!DOCTYPE html">
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/css/doc.css" />
<link rel="stylesheet" href="assets/ztree/css/zTreeStyle/zTreeStyle.css" />

<style type="text/css">
	.active{border-bottom: 3px solid red;}
</style>
<title>POST</title>
</head>
<body>
	<div class="navbar navbar-inverse navbar-fixed-top" role="banner">
		<div class="container">
			<div class="navbar-header">
				<button class="navbar-toggle" type="button" data-toggle="collapse"
					data-target=".bs-navbar-collapse">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
				<a href="." class="navbar-brand">数据家乡</a>
			</div>
			<nav class="collapse navbar-collapse bs-navbar-collapse"
				role="navigation">
				<ul class="nav navbar-nav">
					<li><a href="index.html">发布信息</a></li>
					<li class="active"><a href="create.html">开通站点</a></li>
				</ul>
			</nav>
		</div>
	</div>
	<div class="container bs-docs-container">
		<div class="row" style="border-bottom: 1px solid #CCCCCC;">
			<div class="col-md-12">
				<h1>
					开通站点 <small>向指定行政区域开通站点</small>
				</h1>

			</div>
		</div>
		<br>
		<div class="row">
			<div class="col-md-3">
				<ul id="tree" class="ztree" style="width:230px; overflow:auto;"></ul>
			</div>
			<div class="col-md-9">

				<form action="/discuz/rest/forum/create" method="post">
					<div class="row">
						<div class="col-md-4">
						<label>版块：</label> 
							<input type="text" class="form-control" name="fup" id="fup" value="" readonly="readonly" /><br> 
						</div>
						<div class="col-md-4">
						<label>类型：</label> 
							<input type="text" class="form-control" name="type" id="type" value="" readonly="readonly"  /><br>
						</div>
						<div class="col-md-4">
						<label>上级行政区域名：</label> 
							<input type="text" class="form-control" id="areaname" value="通过REST开通的村" /><br>
						</div>
					</div>
					<div class="row">
						<div class="col-md-4">
						<label>版主：</label> 
							<input type="text" class="form-control"value="" readonly="readonly"   data-toggle="modal" data-target="#myModal"/><br> 
						</div>
						<div class="col-md-4">
						<label>行政区域：</label> 
							<input type="text" class="form-control" name="area" id="area" value="000001" readonly="readonly"  /><br>
						</div>
						<div class="col-md-4">
						<label>村名：</label> 
							<input type="text" class="form-control" name="name" id="name" value="" /><br>
						</div>
					</div>
					<label>介绍：</label>
					<textarea rows="20" class="form-control" cols="50" name="rules">
			望城区东城镇地处长沙市北郊，西临湘江，北抵湘阴，与茶亭镇、铜官镇相邻；镇域总面积56平方公里，内有长沙市第二大垸¬¬——苏蓼垸，辖7个行政村，1个社区居委会，共189个村民组，人口19000人。地形分垸区和丘陵区，垸区水域面积广大，水质优良，水产品养殖水面13000亩，鲜鱼年产量1600吨；低山丘陵区常年有地下水外溢，清澈透明。全镇年平均气温为16.9℃，全年变化呈单峰型，年总降水日为165天，水量为1600mm，年平均日照为1610小时，土壤成土母质第四纪红色粘土，盛产稻谷，全镇耕地面积近4万亩，粮食年产量18000吨；素有望城 “鱼米之乡”的美称。
					</textarea>
					<br> <input type="submit" value="提交" class="btn btn-success" /><br>
				</form>
			</div>
		</div>
		
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">设置版主</h4>
      </div>
      <div class="modal-body">
        <label>用户名：</label>
        <input type="text" class="form-control" id="user" ><br>
        <input type="button" class="btn btn-primary" id="searchBtn" value="查询用户" />
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">确定</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
		
		<script type="text/javascript" src="assets/js/jquery.min.js"></script>
		<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="assets/ztree/js/jquery.ztree.all-3.5.min.js"></script>

<script type="text/javascript">
	<!--
	$("#searchBtn").click(function(){
		$.ajax({
			cache : false,
			url : "/discuz/rest/member/get/"+$("#user").val(),
			type : "GET",
			dataType : 'json',
			success : function(result, status) {
				alert(result.uid+'\n'+result.username);
			},
			error : function() {
				alert("get estimate position failed!");
			}
		});
	});

	var setting = {
		view : {
			selectedMulti : false
		},
    	callback: {
    		onClick: ztreeOnClick,
    	}

	};
	
	//点击树节点操作
	function ztreeOnClick(event, treeId, treeNode) {
		if (treeNode.fid != "" || undefined != treeNode.fid)
			$("#fup").attr("value", treeNode.fid);
		else
			$("#fup").attr("value", "");
		$("#areaname").attr("value", treeNode.name);
		if("group"==treeNode.type)
			$("#type").attr("value", "forum");
		if("forum"==treeNode.type)
			$("#type").attr("value", "sub");
	}
	
	
	$(document).ready(function() {

		$.ajax({
			cache : false,
			url : "/discuz/rest/forum/group",
			type : "GET",
			dataType : 'json',
			success : function(result, status) {
				var node = result;
				zTreeObj = $.fn.zTree.init($("#tree"), setting, node);
			},
			error : function() {
				alert("get estimate position failed!");
			}
		});

	});

//-->
</script>
</body>
</html>